/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Mark
 */
@Entity
@Table(name = "flights", catalog = "ticketsaler", schema = "")
@NamedQueries({@NamedQuery(name = "Flights.findAll", query = "SELECT f FROM Flights f"), @NamedQuery(name = "Flights.findByFno", query = "SELECT f FROM Flights f WHERE f.fno = :fno"), @NamedQuery(name = "Flights.findByFmodel", query = "SELECT f FROM Flights f WHERE f.fmodel = :fmodel"), @NamedQuery(name = "Flights.findBySeatcount", query = "SELECT f FROM Flights f WHERE f.seatcount = :seatcount")})
public class Flights implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "FNO")
    private Integer fno;
    @Basic(optional = false)
    @Column(name = "FMODEL")
    private String fmodel;
    @Basic(optional = false)
    @Column(name = "SEATCOUNT")
    private int seatcount;

    public Flights() {
    }

    public Flights(Integer fno) {
        this.fno = fno;
    }

    public Flights(Integer fno, String fmodel, int seatcount) {
        this.fno = fno;
        this.fmodel = fmodel;
        this.seatcount = seatcount;
    }

    public Integer getFno() {
        return fno;
    }

    public void setFno(Integer fno) {
        Integer oldFno = this.fno;
        this.fno = fno;
        changeSupport.firePropertyChange("fno", oldFno, fno);
    }

    public String getFmodel() {
        return fmodel;
    }

    public void setFmodel(String fmodel) {
        String oldFmodel = this.fmodel;
        this.fmodel = fmodel;
        changeSupport.firePropertyChange("fmodel", oldFmodel, fmodel);
    }

    public int getSeatcount() {
        return seatcount;
    }

    public void setSeatcount(int seatcount) {
        int oldSeatcount = this.seatcount;
        this.seatcount = seatcount;
        changeSupport.firePropertyChange("seatcount", oldSeatcount, seatcount);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (fno != null ? fno.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Flights)) {
            return false;
        }
        Flights other = (Flights) object;
        if ((this.fno == null && other.fno != null) || (this.fno != null && !this.fno.equals(other.fno))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "view.Flights[fno=" + fno + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
